import Vue from 'vue'
import App from './App'
import store from './store' // store
import plugins from './plugins' // plugins
import './permission' // permission
import config from './config'
Vue.use(plugins)

Vue.config.productionTip = false
Vue.prototype.$store = store

App.mpType = 'app'

const isValidUrl = (url) =>{
  try {
    new URL(url);
    return true;
  } catch (_) {
    return false;
  }
}

Vue.filter('getImage', function (value) {
  if (!value) return '';
  return  isValidUrl(value) ? value : config.baseUrl + value;
});

const app = new Vue({
  ...App
})

app.$mount()
